// 收货地址
const addressModule = {
    namespaced: true,
    state: {
        list: []
    },
    getters: {
        // 地址列表
        addressList: state => state.list
    },
    mutations: {
        /**
         * 
         * @param {*} state 
         * @param {*} payload {id,name,tel,address}
         */
        addAdress(state, payload) {
            const { addressDetail, areaCode, city, isDefault, name, tel, provice } = payload
            const theAddress = {
                address: city + provice + county + addressDetail,
                id: areaCode,
                tel,name,isDefault
            }
            // push新的地址到list
            state.list.push(payload);
            console.log(state.list);

        }
    }
}
export default addressModule